AP CSP Create Task

Clean No-Comments PPR Version

Purpose: This page contains a clean Java example with no comments so the correct sections can be used for the Personalized Project Reference (PPR).
Important: For the actual PPR screenshots, students should capture only the required code sections and should not include comments, labels, or teacher notes.

Full Clean Java Program

import java.util.ArrayList;
import java.util.Scanner;

public class CreateTaskStudyHelper {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        ArrayList<Integer> scores = new ArrayList<Integer>();
        scores.add(72);
        scores.add(88);
        scores.add(95);
        scores.add(67);
        scores.add(81);

        System.out.print("Enter a score to add to the list: ");
        int newScore = input.nextInt();
        scores.add(newScore);

        System.out.print("Enter the passing score cutoff: ");
        int passingScore = input.nextInt();

        String result = analyzeScores(scores, passingScore);

        System.out.println("\n--- Score Report ---");
        System.out.println("Scores: " + scores);
        System.out.println(result);

        input.close();
    }

    public static String analyzeScores(ArrayList<Integer> scoreList, int cutoff) {
        int passingCount = 0;
        int failingCount = 0;
        int total = 0;

        for (int i = 0; i < scoreList.size(); i++) {
            int currentScore = scoreList.get(i);
            total = total + currentScore;

            if (currentScore >= cutoff) {
                passingCount++;
            } else {
                failingCount++;
            }
        }

        double average = (double) total / scoreList.size();

        return "Passing: " + passingCount +
               "\nFailing: " + failingCount +
               "\nAverage: " + average;
    }
}

PPR Screenshot Sections

1. Procedure

public static String analyzeScores(ArrayList<Integer> scoreList, int cutoff) {
    int passingCount = 0;
    int failingCount = 0;
    int total = 0;

    for (int i = 0; i < scoreList.size(); i++) {
        int currentScore = scoreList.get(i);
        total = total + currentScore;

        if (currentScore >= cutoff) {
            passingCount++;
        } else {
            failingCount++;
        }
    }

    double average = (double) total / scoreList.size();

    return "Passing: " + passingCount +
           "\nFailing: " + failingCount +
           "\nAverage: " + average;
}

2. Procedure Call

String result = analyzeScores(scores, passingScore);

3. List Storage

ArrayList<Integer> scores = new ArrayList<Integer>();
scores.add(72);
scores.add(88);
scores.add(95);
scores.add(67);
scores.add(81);
scores.add(newScore);

4. List Use

for (int i = 0; i < scoreList.size(); i++) {
    int currentScore = scoreList.get(i);
    total = total + currentScore;

    if (currentScore >= cutoff) {
        passingCount++;
    } else {
        failingCount++;
    }
}

Directions for Students